/*
 * @Description: 检测对象是否在一个原型链中
 * @Author: zzj
 * @Date: 2021-09-01 22:46:46
 * @LastEditors: zzj
 * @LastEditTime: 2021-09-02 14:29:42
 */

//检测对象是否在一个原型链中(家族)
//isPrototypeOf()   检测一个对象是否存在于另一个对象的原型链上(原型的指向)
//instanceof    检测一个对象是否是某个构造函数的实例(new)
var str = new String("zhangsan");
console.log(str instanceof String);
console.log(str instanceof Object);
function Animal(){}
var dog1 = new Animal();
console.log(dog1 instanceof Animal);
console.log(dog1 instanceof Object);

function Dog(){}
Dog.prototype = new Animal();   //原型链继承
var dog2 = new Dog();
console.log(Animal.prototype.isPrototypeOf(dog2));
var obj={};
console.log(Object.prototype.isPrototypeOf(obj));